<?php
/**
 *	[TWCMS] (C)2012 TongWang Inc.
 *	$Id: global_page.lib.php 2 2013-04-27 07:14:17Z nanown@qq.com $
 */
class global_page{
	function __construct($C) {
		$_ENV->V['place'] = place($_ENV->V['cid']);
		$_ENV->V['topcid'] = isset($_ENV->V['place'][0]['cid']) ? $_ENV->V['place'][0]['cid'] : 0;

		$data = $_ENV->db->fetch_first('SELECT '.($_ENV->G['ishtml'] ? 'C.dir,C.parentdir,C.cate_url,' : '').'C.categoryname,P.content FROM `'.TW_DBPRE.'category` C LEFT JOIN `'.TW_DBPRE.'page` P ON C.cid=P.cid WHERE C.cid='.$_ENV->V['cid']);
		if(is_array($data)) {
			$_ENV->V = array_merge($_ENV->V, $data);
			$_ENV->G['ishtml'] && $GLOBALS['html_path'] = rep_url($data['cate_url'], $data['parentdir'], $data['dir'], $_ENV->V['cid']);
		}
	}
}